package cn.xydpeng.springframework.context.support;

import cn.xydpeng.springframework.beans.BeansException;
import cn.xydpeng.springframework.context.ApplicationContext;
import cn.xydpeng.springframework.core.io.Resource;
import cn.xydpeng.springframework.lang.Nullable;

/**
 * @author xydpeng
 * @version v1.0
 * @date: 2022/10/17
 * @description:
 */
public class ClassPathXmlApplicationContext extends AbstractXmlApplicationContext {
    @Nullable
    private Resource[] configResources;

    public ClassPathXmlApplicationContext() {
    }

    public ClassPathXmlApplicationContext(String... configLocations) throws BeansException {
        this(configLocations, true, null);
    }

    public ClassPathXmlApplicationContext(String[] configLocations, boolean refresh, @Nullable ApplicationContext parent)
            throws BeansException {
        super(parent);
        setConfigLocations(configLocations);
        if (refresh) {
            refresh();
        }
    }


    @Override
    protected Resource[] getConfigResources() {
        return this.configResources;
    }
}
